package com.code.day010JieKo.not08DuoTai;

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        method(dog);


        Cat11 cat11 = new Cat11();
        method(cat11);

    }

    // 父类引用作为参数（多态：接收所有子类对象）
    public static void method(Dome dome) {
        if (dome instanceof Dog dog) {
            dog.method();
            dog.method1();
        }
        if (dome instanceof Cat11 cat11) {
            cat11.method();
            cat11.method1();
        }

    }

}
